package com.tiany.java_study_exercise;
//三角形
public class TriAngleTest {
    public static void main(String[] args){
        TriAngle triAngle=new TriAngle();
        triAngle.setBase(15.1);
        triAngle.setHeight(5);
        System.out.println("底："+triAngle.getBase()+" 高: "+triAngle.getHeight()+" 面积："+triAngle.getArea());

    }
}

class TriAngle{
    private double base;//底边长
    private double height;

    public double getBase() {
        return base;
    }

    public double getHeight() {
        return height;
    }
    public double getArea(){
        return 0.5*base*height;
    }

    public void setBase(double base) {
        this.base = base;
    }

    public void setHeight(double height) {
        this.height = height;
    }
    public TriAngle(){
        this.getArea();
        //构造器
    }
    public TriAngle(double base){
        this();
        this.setBase(base);

    }
}
